/**
 * Created by loso on 2017/3/27.
 */
public class _125_ValidPalindrome {

    public static void main(String[] args) {
        _125_ValidPalindrome a = new _125_ValidPalindrome();
        System.out.println(a.isPalindrome("0P"));
    }

    public boolean isPalindrome(String s) {
        s = s.toLowerCase().replaceAll("[^a-z0-9]","");
        if (s.equals("")){
            return true;
        }
        int indexs = 0;
        int indexe = s.length()-1;
        while (indexs<=indexe){
            if(s.charAt(indexs)!=s.charAt(indexe)){
                return false;
            }
            indexs++;
            indexe--;
        }
        return true;
    }
}
